﻿using AppService.IService.Basic_information;
using Domain.Entity.Basic_information;
using Domain.IRepository.Basic_information;
using Domain.IRepository.System_setting;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;

namespace AppService.Service.Basic_information
{
    [Dependency(ServiceLifetime.Scoped)]
    public class DriversService : IDriversService
    {

        public IDriversRepository drivers { get; set; }

        public DriversService(IDriversRepository drivers)
        {
            this.drivers = drivers;
        }

        public List<Drivers_ment> GetDrivers(int currentPage, int pageSize, string date1, string date2, string value2)
        {
            return drivers.GetDrivers(date1, date2, value2).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public int GetCount(string date1, string date2, string value2)
        {
            return drivers.GetCount(date1, date2, value2);
        }

        public bool AddDrivers(Drivers_ment driver)
        {
            return drivers.AddDrivers(driver) > 0;
        }

        public Drivers_ment GetDriver(int id)
        {
            return drivers.GetDriver(id);
        }

        public bool UpdDrivers(Drivers_ment driver)
        {
            return drivers.UpdDrivers(driver) > 0;
        }

        public bool DelDriver(int id)
        {
            return drivers.DelDriver(id) > 0;
        }

        public Drivers_ment GetDriverById(int id)
        {
            return drivers.GetById(id);
        }
    }
}
